import type { RouteRecordRaw } from 'vue-router'

const siteRoutes: RouteRecordRaw[] = [
  {
    path: '/site/analyze',
    name: 'SiteStatistic',
    redirect: { name: 'FlowAnalyze' },
    meta: {
      title: '数据统计',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'SiteStatistic',
      tabs: [
        {
          key: 'FlowAnalyze',
          title: '流量分析'
        },
        {
          key: 'safeAnalyze',
          title: '安全分析'
        }
      ]
    },
    children: [
      {
        path: 'flow',
        name: 'FlowAnalyze',
        component: () => import('@/views/site/statistic/flow')
      },
      {
        path: 'safe',
        name: 'safeAnalyze',
        component: () => import('@/views/site/statistic/safe')
      }
    ]
  },
  {
    path: '/site/list',
    name: 'SiteList',
    component: () => import('@/views/site/site-list'),
    meta: {
      title: '站点列表',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'SiteList'
    }
  },
  {
    path: 'site-config/:id',
    name: 'SiteConfig',
    meta: {
      title: '站点配置',
      parentTitle: '站点列表',
      showPageHeader: true,
      parentName: 'Site',
      showBack: true,
      currentActiveMenu: 'SiteList',
      tabs: [
        {
          key: 'SiteConfigureBase',
          title: '基础信息'
        },
        {
          key: 'SiteConfigureSource',
          title: '源站配置'
        },
        {
          key: 'LicenseAgreement',
          title: '证书协议'
        },
        {
          key: 'SiteConfigureCacheClear',
          title: '清理缓存'
        },
        {
          key: 'SiteConfigureCacheOptimize',
          title: '缓存优化'
        },
        {
          key: 'SiteConfigureAccessControl',
          title: '访问控制'
        },
        {
          key: 'SiteConfigureSecurity',
          title: '安全配置'
        },
        {
          key: 'SiteConfigureConversion',
          title: '转换规则'
        }
      ]
    },
    redirect: { name: 'SiteConfigureBase' },
    children: [
      {
        path: 'base',
        name: 'SiteConfigureBase',
        component: () => import('@/views/site/modules/base-info')
      },
      {
        path: 'license',
        name: 'LicenseAgreement',
        component: () => import('@/views/site/modules/license-agreement')
      },
      {
        path: 'source',
        name: 'SiteConfigureSource',
        component: () => import('@/views/site/modules/source-configuration')
      },
      {
        path: 'cacheClear',
        name: 'SiteConfigureCacheClear',
        component: () => import('@/views/site/modules/cache-clear')
      },
      {
        path: 'cacheOptimize',
        name: 'SiteConfigureCacheOptimize',
        component: () => import('@/views/site/modules/cache-optimize')
      },
      {
        path: 'accessControl',
        name: 'SiteConfigureAccessControl',
        component: () => import('@/views/site/modules/access-control')
      },
      {
        path: 'security',
        name: 'SiteConfigureSecurity',
        component: () => import('@/views/site/modules/security-config')
      },
      {
        path: 'conversion',
        name: 'SiteConfigureConversion',
        component: () => import('@/views/site/modules/conversion-rules')
      }
    ]
  },
  {
    path: 'site/log',
    name: 'SiteLog',
    component: () => import('@/views/site/log/SiteLog.vue'),
    meta: {
      title: '安全日志',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'SiteLog'
    }
  },
  {
    path: 'site/presets-rule',
    name: 'PresetsRule',
    component: () => import('@/views/site/rule/SiteRule.vue'),
    meta: {
      title: '预设规则',
      showPageHeader: true,
      showBack: false,
      currentActiveMenu: 'PresetsRule'
    }
  }
]
export default siteRoutes
